package com.example.config.reciver;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 配置多台监听(相当于多个消费者)绑定到同一个直连交互的同一个队列
 * 轮询的方式对消息进行消费，而且不存在重复消费
 */
@Component
public class DirectReceiver2 {
    @RabbitListener(queues = "directQueue")
    @RabbitHandler
    @SendTo("directQueue")
    public String comsumeDirectQueue(Map message){
        System.out.println("DirectReceiver2消费者收到消息:" + message);
        return "SUCCESS2";
    }
}
